import {GlobalInfo} from "../GlobalInfo"
export class AdminService{
    static AddCategory = async (caption:string):Promise<any>=>{
        var text = await GlobalInfo.post("/Admin/AddCategory" , {caption});
        return JSON.parse(text);
    }

    static DeleteCategory = async (id:any):Promise<void>=>{
        await GlobalInfo.post("/Admin/DeleteCategory" , {id});
        
    }

    static UpdateCategory = async (id:any,caption:string):Promise<void>=>{
        await GlobalInfo.post("/Admin/UpdateCategory" , {id,caption});
        
    }

    static AddDoc = async (caption:string,categoryId:any):Promise<any>=>{
        var text = await GlobalInfo.post("/Admin/AddDoc" , {caption,categoryId});
        return JSON.parse(text);
    }

    static UpdateDoc = async (caption:any,content:any,id:any):Promise<void>=>{
        await GlobalInfo.post("/Admin/UpdateDoc" , {caption,content,id});
    }

    static DeleteDoc = async (id:any):Promise<void>=>{
        await GlobalInfo.post("/Admin/DeleteDoc" , {id});
        
    }

    static UpdateCategorySorts = async (ids:any[]):Promise<void>=>{
        await GlobalInfo.post("/Admin/UpdateCategorySorts" , {ids});
        
    }

    static UpdateDocSorts = async (ids:any[]):Promise<void>=>{
        await GlobalInfo.post("/Admin/UpdateDocSorts" , {ids});
        
    }
}